<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../../css/我的分页/topbase.css">
    <script src="../../js/rem.js"></script>
    <link rel="stylesheet" href="http://at.alicdn.com/t/font_1432742_97o7jngbxvc.css">
    <link rel="stylesheet" href="../../css/我的分页/address.css">
    <script src="../../js/jquery-1.11.3.min.js"></script>
    <script src="../../js/axios.min.js"></script>
</head>

<body>
    <header>
        <a href="../我的易果.html">
            <div class="iconfont icon-changyongtubiao-xianxingdaochu-zhuanqu-1"></div>
        </a>
        <h1>管理收获地址</h1>
    </header>
    <main>
        <!-- <div class="pic iconfont icon-weizhi"></div>
        还没有收货地址哦 -->
        <ul>
            <!-- <li>
                <div class="top">
                    <span class=".name">王雪豪</span>
                    <span class="phone">17866666666</span>
                    <div>家庭</div>
                </div>
                <div class="bot">
                    <div class="address">河南</div>
                </div>
                <div class="edit iconfont icon-bianji"></div>
            </li> -->

        </ul>

    </main>
    <footer>
        + 添加收货地址
    </footer>
    <script src="../../js/api.js"></script>
    <script>
        $(function () {
            $("footer").click(function () {
                location.href = "./add_address.html"
            })
            $('.edit').click(function () {
                location.href = "./add_address.html"
            })
        })
        //展示收获地址
        $(function () {
            axios.get(showAddress_Api, {
                params: {
                    id
                }
            }).then(res => {
                console.log(res.data);
                let html = res.data.map(v=>`
                <li>
                <div class="top">
                    <span class=".name">${v.name}</span>
                    <span class="phone">${v.phonenum}</span>
                    <div>${v.addressType}</div>
                </div>
                <div class="bot">
                    <div class="address">${v.address}</div>
                </div>
                <div class="edit iconfont icon-bianji" data-id=${v.id}></div>
            </li>
                `).join('')
                $('ul').append(html)
                //修改地址信息
                $('.edit').click(function(){
                    let id = this.getAttribute('data-id')
                    // axios.get(editAddress2,{params:{id}}).then(res=>{
                    //     console.log(res);
                    // })
                    location.href=`./add_address.html?id=${id}`
                })
            })
        })
    </script>
</body>

</html>